import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { IotDeviceOperLogVO, IotDeviceOperLogForm, IotDeviceOperLogQuery } from '@/api/tearoom/iotDeviceOperLog/types';

/**
 * 查询IoT设备操作日志列表
 * @param query
 * @returns {*}
 */

export const listIotDeviceOperLog = (query?: IotDeviceOperLogQuery): AxiosPromise<IotDeviceOperLogVO[]> => {
  return request({
    url: '/tearoom/iotDeviceOperLog/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询IoT设备操作日志详细
 * @param id
 */
export const getIotDeviceOperLog = (id: string | number): AxiosPromise<IotDeviceOperLogVO> => {
  return request({
    url: '/tearoom/iotDeviceOperLog/' + id,
    method: 'get'
  });
};

/**
 * 新增IoT设备操作日志
 * @param data
 */
export const addIotDeviceOperLog = (data: IotDeviceOperLogForm) => {
  return request({
    url: '/tearoom/iotDeviceOperLog',
    method: 'post',
    data: data
  });
};

/**
 * 修改IoT设备操作日志
 * @param data
 */
export const updateIotDeviceOperLog = (data: IotDeviceOperLogForm) => {
  return request({
    url: '/tearoom/iotDeviceOperLog',
    method: 'put',
    data: data
  });
};

/**
 * 删除IoT设备操作日志
 * @param id
 */
export const delIotDeviceOperLog = (id: string | number | Array<string | number>) => {
  return request({
    url: '/tearoom/iotDeviceOperLog/' + id,
    method: 'delete'
  });
};

/**
 * 删除IoT设备操作日志
 * @param id
 */
export const cleanAllOperLog = (deviceKey: string | number | Array<string | number>) => {
  return request({
    url: '/tearoom/iotDeviceOperLog/delAll/' + deviceKey,
    method: 'delete'
  });
};
